<?php
// +---------------------------------------------------------------------------+
// | This file is part of the KnowledgebasePublisher package                   |
// | KnowledgebasePublisher - web based knowledgebase publisher tool           |
// |                                                                           |
// | Author:  Evgeny Leontev <eleontev@gmail.com>                              |
// | Copyright (c) 2005 Evgeny Leontev                                         |
// |                                                                           |
// | For the full copyright and license information, please view the LICENSE   |
// | file that was distributed with this source code.                          |
// +---------------------------------------------------------------------------+

class FileCategory extends AppObj
{
	
	var $properties = array('id'		 	=> NULL,
							'parent_id' 	=> 0,
							'name' 			=> '',
							'description'	=> '',
							'sort_order' 	=> 0,
							'private'		=> 0,
							'active'		=> 1
							);
	
	
	var $hidden = array('id');
	var $member_role = array();
	
	
	function getMemberRole() {
		return $this->member_role;
	}
	
	function setMemberRole($role) {
		$this->member_role = $role;
	}		
	
	function validate($values) {
		
		require_once 'eleontev/Validator.php';
		
		$required[] = 'name';
		
		if($values['parent_id'] != 0) {
			$required[] = 'parent_id';
		}
		
		$v =& new Validator($values, false);

		// check for required first, return errors
		$v->requiredArray('required_msg', $required);
		if($v->getErrors()) {
			$this->errors =& $v->getErrors();
			return true;
		}
	}
	
}
?>